#ifndef SPINBOXDELEGATE_H
#define SPINBOXDELEGATE_H

#include <QStyledItemDelegate>

class SpinBoxDelegate : public QStyledItemDelegate
{
    Q_OBJECT
public:
    explicit SpinBoxDelegate(QObject *parent = 0);

    QWidget* createEditor (QWidget *parent , const QStyleOptionViewItem &option , const QModelIndex &index) const;
    void setEditorData (QWidget *editor, const QModelIndex &index) const;
    void setModelData (QWidget *editor , QAbstractItemModel *model , const QModelIndex &index) const;

public slots:
    void setRange (int rangeStart, int rangeEnd);
    void setDefaultValue (int defaultValue);

protected:
    mutable int m_oldValue;
    int m_rangeStart;
    int m_rangeEnd;
    int m_defaultValue;
};

#endif // SPINBOXDELEGATE_H
